//
//  PopoverViewController.m
//  Weibo
//
//  Created by Justsoso on 16/4/26.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "PopoverViewController.h"

#import "TaskViewController.h"
@interface PopoverViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic,strong)TaskViewController *task;
@property(nonatomic,strong)UITableViewCell *cell;


@end

@implementation PopoverViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSArray *arr1 = [[NSArray alloc]initWithObjects:@"全部分类", @"活动",@"文章",@"关注",nil];
    NSArray *arr2 = [[NSArray alloc]initWithObjects:@"智能排序",@"最新上线",@"最高回报",nil];
    self.allKinds = arr1;
    self.sequence = arr2;
    self.view.backgroundColor = [UIColor clearColor];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
   
    [self setExtraCellLineHidden:self.tableView];
    

}

//隐藏多余单元格
-(void)setExtraCellLineHidden: (UITableView *)tableView
{
    UIView *view = [UIView new];
    
    view.backgroundColor = [UIColor clearColor];
    
    [tableView setTableFooterView:view];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    //return self.popList.count;
    if(self.index == 13)
    {
         return self.allKinds.count;
    }else if (self.index == 32)
    {
        return self.sequence.count;
    }else{
        return self.allKinds.count;
    }
   
  
}
// 单元格高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 50;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    
   // cell.textLabel.text=self.popList[indexPath.row][@"town"];
    if(self.index == 13)
    {
     cell.textLabel.text = self.allKinds[indexPath.row];
    }else if (self.index == 32)
    {
     cell.textLabel.text = self.sequence[indexPath.row];
    }else
    {
     cell.textLabel.text = self.allKinds[indexPath.row];
    }
    
    return cell;
}
//选中某一行
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{

    
}

@end
